package cn.edu.ren.service.imp;

import cn.edu.ren.mapper.IUserMapper;
import cn.edu.ren.pojo.User;
import cn.edu.ren.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @PackageName: cn.edu.ren.service.imp
 * @ClassName: UserServiceImp
 * @Description:
 * @author: RZS
 * @date: 2021/5/20  17:09
 */
@Service
public class UserServiceImp implements IUserService {

    @Autowired
    private IUserMapper userMapper;

    @Override
    public List<User> findAll() {
        return userMapper.selectAll();
    }

    @Override
    public User findById(Integer id) {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public void addUser(User user) {
        userMapper.insert(user);
    }

    @Override
    public User findByName(String name) {
        return userMapper.selectByName(name);
    }
}
